﻿<UserControl x:Class="DemoNYTimes.CommunityCommentsByDatePage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:nytvc="clr-namespace:NYTimes.ValueConverters;assembly=NYTimesSilverlightKit"
    d:DesignWidth="640" d:DesignHeight="480" 
    xmlns:nyt="clr-namespace:NYTimes;assembly=NYTimesSilverlightKit" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" 
    xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls">
	<UserControl.Resources>
		<nyt:CommunityCommentsByDate x:Key="CommentsByDateDS" d:IsDataSource="True"/>
        <nytvc:FrameworkElementTagToCommentSortTypeConverter x:Key="CommentSortTypeConverter"/>
	</UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="White">
    	<Grid.RowDefinitions>
    		<RowDefinition Height="Auto"/>
    		<RowDefinition/>
    	</Grid.RowDefinitions>
    	<StackPanel Orientation="Horizontal">

    		<basics:DatePicker SelectedDate="{Binding Mode=TwoWay, Path=Date, Source={StaticResource CommentsByDateDS}}" Height="Auto" VerticalAlignment="Stretch" Margin="2,2,2,2"/>
    		<TextBlock Text="Results:" TextWrapping="Wrap" VerticalAlignment="Center" Margin="2,2,2,2"/>
    		<TextBlock Text="{Binding Mode=OneWay, Path=Results.Count, Source={StaticResource CommentsByDateDS}}" TextWrapping="Wrap" VerticalAlignment="Center" Margin="2,2,2,2"/>
    		<TextBlock Text="Sort By:" TextWrapping="NoWrap" VerticalAlignment="Center" Margin="2,2,2,2"/>
    		<ComboBox Margin="2,2,2,2" SelectedItem="{Binding Mode=TwoWay, Path=Sort, Source={StaticResource CommentsByDateDS}, Converter={StaticResource CommentSortTypeConverter}}">
    			<ComboBoxItem Content="Newest" Tag="Newest"/>
    			<ComboBoxItem Content="Oldest" Tag="Oldest"/>
    			<ComboBoxItem Content="Recommended" Tag="Recommended"/>
    			<ComboBoxItem Content="Replied" Tag="Replied"/>
    			<ComboBoxItem Content="Editors' Selection" Tag="EditorsSelection"/>
    		</ComboBox>
    	</StackPanel>
    	<ListBox Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Grid.Row="1" ItemsSource="{Binding Results, Source={StaticResource CommentsByDateDS}}" ItemTemplate="{StaticResource CommentTemplate}" ScrollViewer.HorizontalScrollBarVisibility="Disabled"/>

    </Grid>
</UserControl>
